home *** CD-ROM | disk | FTP | other *** search
/ Risc World 3 / Risc World 3.iso / SOFTWARE / ISSUE2 / PD / CAMPINS.ZIP / resources / camchk (.txt) next >
RISC OS BBC BASIC V Source  |  2002-06-06  |  5KB  |  211 lines

  1.  ON ERROR PRINT ERR,"Line:";ERL,REPORT$:END
  2.  V1.40
  3.  buffer2% 512
  4.  "OS_GetEnv" 
  5.  buffer2%
  6. !command$=
  7. getstring(buffer2%)
  8. 3path$=
  9. command$,
  10. (command$)-
  11. command$,""" ")-1)
  12. path$,1)=
  13.  path$=
  14. path$,2)
  15. path$,1)=
  16.  path$=
  17. path$,
  18.  path$-1)
  19. rzstring$=
  20. canonpath(path$)
  21.  rzstring$="ADFS::HardDisc4.$.cURL.CamPins.resources.image"
  22.  forces the Image to be closed just in case its been left open.
  23. opencheck(rzstring$) <>0 
  24.  "OS_Find",&00,rzfilehandle%
  25.  check to see if Image file exists
  26. "OS_File",5,rzstring$ 
  27.  rzfound%
  28.  rzfound%=0 
  29. ("set campinf 0") 
  30. ("set campinf 1")
  31. ("Set ChangeFSI$Y 0")
  32. ("Set ChangeFSI$X 0")
  33.  rzfound%>0 
  34.  Checks to see if CURL download size checks with actual size of Image file.
  35.  "OS_GSTrans","<curl_size_download>",buffer2%,512
  36. %   rzsize%=
  37. getstring(buffer2%)
  38. "OS_File",5,rzstring$ 
  39.  ,,,,rzsizeactual%
  40.  rzsize% <> rzsizeactual% 
  41.  rzfound%=0   
  42.  rzfound%>0 
  43. #&   
  44.  Read what type of file it is.
  45. $*   
  46. "OS_Find",&C0,rzstring$ 
  47.  handle%
  48.    ident$=
  49. #handle%
  50. #handle%
  51.  Check to see if JPEG is a nonstandard 'AXIS' type.
  52.  If it is. Clean it up.
  53. rzflag%=
  54. :htmlflag%=
  55. ->   
  56.  rzflag%= 
  57. ident$,"AXIS") 
  58.  rzflag%=
  59. ("Cleanup")
  60. .]   
  61.  rzflag%= 
  62. ident$,"HTML") 
  63. ident$,"head")) 
  64.  rzflag%=
  65. :htmlflag%=
  66. notfound:
  67. /P   
  68.  rzflag%= 
  69. ident$,"JFIF") 
  70.  rzflag%=
  71. ("settype "+rzstring$+" C85")
  72. 0P   
  73.  rzflag%= 
  74. ident$,"GIF")  
  75.  rzflag%=
  76. ("settype "+rzstring$+" 695")
  77. 1;   
  78.  rzflag%= 
  79. ident$,"MM")  
  80. ident$,"II*") ) 
  81.       rzflag%=
  82. 3(      
  83. ("settype "+rzstring$+" FF0")
  84.       
  85. "<campin$dir>.CFSI"
  86.       
  87. 6[      A$="<campin$dir>.CFSI <campin$dir>.image <campin$dir>.sprite 1 -nodither -nomode"
  88.       foo%=1
  89. 80      A%=
  90. ChangeFSI(A$,-1,-1,0,-1,-1,foo%,
  91. 95      
  92. ("Seteval ImageSize$Height <ChangeFSI$Y>")
  93. :7      
  94. ("Seteval ImageSize$Width <ChangeFSI$X>")   
  95. <3      
  96. ("<campin$dir>.imagesize -n "+rzstring$)
  97.       
  98. ?8   
  99.  "OS_GSTrans","<ImageSize$Height>",buffer2%,512
  100. @%   height%=
  101. getstring(buffer2%)
  102. A7   
  103.  "OS_GSTrans","<ImageSize$Width>",buffer2%,512
  104. B$   width%=
  105. getstring(buffer2%)
  106. modeinfo
  107.    colours$="28r "
  108. ("Set col "+colours$)
  109.    scale$="1:1"
  110. H-   
  111.  colours% > 3 
  112.  colours$="S16,90,90 "
  113.  PRINT "Got in..."
  114.    iconbarheight%=0:
  115.  width%>height% 
  116. N!       width%+=iconbarheight%
  117. O(       calx%=(xaxisa%/width%)*width%
  118. P)       caly%=(xaxisa%/width%)*height%
  119. Q(       scale$=
  120.  xaxisa%+":"+
  121.  width%
  122.       iconbarheight%=88
  123. T!      height%+=iconbarheight%
  124. U(      calx%=(yaxisa%/height%)*width%
  125. V)      caly%=(yaxisa%/height%)*height%
  126. W(      scale$=
  127.  yaxisa%+":"+
  128.  height%
  129. ZO   
  130.  if image is almost the width of the screen mode, but much taller, then
  131. [G   
  132.  scale it to its height instead. This helps it fit onto screen.
  133. ]2   
  134. (xaxisa%-width%) <99 
  135.  height%>yaxisa% 
  136. ^)       scale$=
  137.  yaxisa%+":"+
  138.  height%
  139. bK   
  140.  if image is small (about half size of screen) then tile it instead
  141. c>   
  142.  (width% <= (xaxisa% /2)) 
  143.  (height% < (yaxisa% /2)) 
  144.       backdrop$="-T"
  145.       scale$="140:100"
  146.       backdrop$="-C"
  147. ("Set col "+colours$)
  148. ("Set bkd "+backdrop$)
  149. ("Set scale "+scale$)
  150. notfound
  151.  PRINT "Passed..."
  152. notfound
  153. ("Set col 28r")
  154. ("Set bkd -T")
  155. ("Set scale 1:1")
  156. yG   
  157.  forces the Image to be closed just in case its been left open.
  158. z"   
  159.  "XOS_Find",&00,rzstring$
  160. {5   
  161. ("Copy campin:Image campin:duffImage ~CFS~V")
  162. |(   
  163. ("setType campin:duffImage 000")
  164. }2   
  165. ("Copy campin:failed campin:Image ~CFS~V")
  166. ~3   
  167. ("Copy campin:failed campin:Sprite ~CFS~V")
  168.  htmlflag%=
  169. ,      
  170. ("settype campin:duffImage HTML")
  171. modeinfo
  172.  "OS_ReadModeVariable",-1,11 
  173.  ,,xaxisa%
  174.  "OS_ReadModeVariable",-1,12 
  175.  ,,yaxisa%
  176.  "OS_ReadModeVariable",-1,4 
  177.  ,,xscale%
  178.  "OS_ReadModeVariable",-1,5 
  179.  ,,yscale%
  180.  "OS_ReadModeVariable",-1,9 
  181.  ,,colours%
  182. ! xaxis%=(xaxisa%*(2^xscale%))
  183. ! yaxis%=(yaxisa%*(2^yscale%))
  184.  xaxisa%+=1:yaxisa%+=1
  185. canonpath(path$)
  186. "OS_FSControl",37,path$,buffer2%,0,0,512
  187. getstring(buffer2%)
  188. getstring(ptr%)
  189.     p$=""
  190.  (?ptr%>31 
  191.  ?ptr%<256) 
  192. (p$)<255
  193.   c%=?ptr%
  194.    IF c%>=97 AND c%<=122 THEN c%-=32
  195.   p$+=
  196.   ptr%+=1
  197. opencheck(rzstring$)
  198.  A%,B%,A$
  199. rzfilehandle%=0
  200.  A%=255 
  201. 2    
  202. "XOS_Args",7,A%,buffer2%,,,512 
  203.  ,,,,,B%
  204.     A$=
  205. getstring(buffer2%)
  206. :    
  207.  B% < 512 
  208.  rzstring$=A$ 
  209.  rzfilehandle%=A%:A%=1 
  210. =rzfilehandle%
  211.